import VueRouter from 'vue-router'

// 导入路由组件
import HomeContainer from './components/tabbars/HomeContainer.vue'
import MemberContainer from './components/tabbars/MemberContainer.vue'
import SearchContainer from './components/tabbars/SearchContainer.vue'
import ShopcarContainer from './components/tabbars/ShopcarContainer.vue'
import NewsList from './components/news/NewsList.vue'
import NewsInfo from './components/news/NewsInfo.vue'
import PhotoList from './components/photos/PhotoList.vue'
import PhotoInfo from './components/photos/PhotoInfo.vue'

// 创建路由对象
const router = new VueRouter({
    routes: [
        { path: '/', redirect: '/home' },
        { path: '/home', component: HomeContainer },
        { path: '/member', component: MemberContainer },
        { path: '/shopcar', component: ShopcarContainer },
        { path: '/search', component: SearchContainer },
        { path: '/home/newslist', component: NewsList },
        // 启用props来接收路由的参数,在组件中直接id就行
        { path: '/home/newsinfo/:id', component: NewsInfo, props: true },
        { path: '/home/photolist', component: PhotoList },
        { path: '/home/photoinfo', component: PhotoInfo, props: true },
    ],
    // 手动设置被激活的路由链接的高亮类名
    linkActiveClass: 'mui-active'
})

// 将路由暴露出去
export default router